package com.example.simplenet;

import java.io.Serializable;
import java.util.Date;

public class AbandonedInfo implements Serializable {
	
	private static final long serialVersionUID = -4737888711417368041L;
	
	private String mName;
	private Date mDate;
	private int mDistance;
	private int mPoints;
	
	public AbandonedInfo(String name, int distance, int points) {
	
		mName = name;
		mDate = new Date();
		mDistance = distance;
		mPoints = points;
	}
	
	public AbandonedInfo(String name, String distance, String points) {
	
		mName = name;
		mDate = new Date();
		mDistance = Integer.parseInt(distance);
		mPoints = Integer.parseInt(points);
	}
	
	public String getName() {
	
		return mName;
	}
	
	public Date getDate() {
		
		return mDate;
	}
	
	public int getDistance() {
	
		return mDistance;
	}
	
	public int getPoints() {
	
		return mPoints;
	}
	
	@Override
	public boolean equals(Object o) {
	
		if (o == null || !o.getClass().equals(getClass()))
			return false;
		AbandonedInfo info = (AbandonedInfo) o;
		return info.getName().equals(mName) && info.getDistance() == mDistance;
	}
	
	public boolean equalsStrict(Object o) {
	
		if (!o.getClass().equals(getClass()))
			return false;
		AbandonedInfo info = (AbandonedInfo) o;
		return info.getName().equals(mName) && info.getDistance() == mDistance
				&& info.getPoints() == mPoints;
	}
	
	@Override
	public int hashCode() {
	
		return mName.hashCode() * mDistance;
	}

}
